package pers.kw.server.service;

import com.alibaba.fastjson.JSON;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;
import pers.kw.contants.RabbitMQContants;
import pers.kw.message.dto.znx.ZnxReqDto;

import javax.annotation.Resource;

/**
 * 站内信通知
 */
@Service
public class ZnxNoticeService {

    @Resource
    private RabbitTemplate rabbitTemplate;

    public void sendZnx(ZnxReqDto reqDto) {
        //uuid存入redis中，消费成功删除
        rabbitTemplate.convertAndSend(RabbitMQContants.ZNX_EXCHANGE, "",
                JSON.toJSONString(reqDto)
                , new CorrelationData(reqDto.getApplyId()));
    }
}
